﻿using System.Windows;
using System.Windows.Controls;
using ViewModel.ViewModels;

namespace Views
{
    /// <summary>
    /// ChatBoxPanel.xaml 的交互逻辑
    /// </summary>
    public partial class ChatBoxPanel : Border
    {
        public ChatBoxPanel()
        {
            InitializeComponent();
        }

        private void Border_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
        {
            if (this.DataContext is RecentlyContactItemViewModel)
            {
                RecentlyContactItemViewModel contactItem = (RecentlyContactItemViewModel)this.DataContext;
                switch (contactItem.ContactItemType)
                {
                    case ClientModels.ContactItemType.用户:
                        {
                            this.ChatBoxGrid.Visibility = Visibility.Visible;
                            this.NewFriendRequestList.Visibility = Visibility.Hidden;
                            break;
                        }

                    case ClientModels.ContactItemType.新的好友:
                        {
                            this.NewFriendRequestList.Visibility = Visibility.Visible;
                            this.ChatBoxGrid.Visibility = Visibility.Hidden;
                            break;
                        }
                }
            }
        }
    }
}